Skip to content

Error on a contract client that predates unwrap() - #830

Closed
stijnvanhulle wants to merge 2 commits into
mainfrom
claude/kubb-plugin-version-error-lafksp
Closed

Error on a contract client that predates unwrap()#830
stijnvanhulle wants to merge 2 commits into
mainfrom
claude/kubb-plugin-version-error-lafksp

Conversation

@stijnvanhulle

Copy link
Copy Markdown
Contributor

Changes

plugin-react-query, plugin-vue-query, and plugin-swr build their generated hooks on unwrap(), a method plugin-fetch and plugin-axios only started attaching to their RequestResult promise in 5.2.0 (#829). With an older plugin-fetch or plugin-axios, the generated hooks called a method that did not exist, and failed at runtime with no clear cause.

resolveContractClient (internals/client/src/resolveClient.ts) now takes a requireUnwrap flag. When set, it reads the resolved client plugin's installed version from the user's project (internals/client/src/resolvePackageVersion.ts) and throws during setup when it predates 5.2.0:

`@kubb/plugin-fetch` is registered at version 5.1.2, but this plugin needs `@kubb/plugin-fetch@5.2.0` or newer.
Generated hooks call `unwrap()` on the client's result, which `@kubb/plugin-fetch` only added in 5.2.0.
Upgrade `@kubb/plugin-fetch` to 5.2.0 or later.

plugin-react-query, plugin-vue-query, and plugin-swr pass requireUnwrap: true. plugin-mcp does not call unwrap(), so it keeps the existing behavior and only picks up the new required root parameter.

Checklist

  • I have followed the steps in the Contributing guide.
  • I have tested this code locally with pnpm run test.

Release Impact

  • This change affects published code, and I have generated a changeset.
  • This change is for the docs (no release).

🤖 Generated with Claude Code

https://claude.ai/code/session_018r9FQxbCd8tL7Npvu8khvL


Generated by Claude Code

…ract client that predates unwrap()

Generated hooks now call unwrap() on the client's result, added to plugin-fetch and
plugin-axios in 5.2.0. An older client plugin generated a client without unwrap(), so the
hooks failed at runtime with no clear cause. resolveContractClient now checks the
registered client plugin's installed version and throws a diagnostic naming the required
version during setup instead.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018r9FQxbCd8tL7Npvu8khvL
@codesandbox

codesandbox Bot commented Sep 2, 2026

Copy link
Copy Markdown

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

@coldtea-pr-lens

coldtea-pr-lens Bot commented Sep 2, 2026

Copy link
Copy Markdown

◈ PR Lens

🟢 +0 new · 🟠 ~5 changed · 🔴 -0 removed · 1 flow · 6 files · commit 4aeaaac


Architecture

Architecture diagram for kubb-labs/plugins at 4aeaaac

5 components touched across 5 lanes.

Open full size


Data flow

Data flow diagram for kubb-labs/plugins at 4aeaaac

Resolving contract client with unwrap version validation

Open full size


Drill down
Internal Foundation — 1 component
🟡 CHANGED @⁠internals/client

Shared client resolution logic that validates installed HTTP client packages (@kubb/plugin-fetch / @kubb/plugin-axios) to ensure minimum version compatibility (>=5.2.0) for unwrap() support.

Data Fetching Hooks — 3 components
🟡 CHANGED @⁠kubb/plugin-react-query

React Query generator plugin, updated to pass project root and requireUnwrap flag during client resolution.

🟡 CHANGED @⁠kubb/plugin-vue-query

Vue Query generator plugin, updated to pass project root and requireUnwrap flag during client resolution.

🟡 CHANGED @⁠kubb/plugin-swr

SWR generator plugin, updated to pass project root and requireUnwrap flag during client resolution.

Integrations & Docs — 1 component
🟡 CHANGED @⁠kubb/plugin-mcp

Model Context Protocol plugin, updated to pass project root during contract client resolution.


View

  • Architecture lens
  • Data flow lens
  • Expand every detail
  • Show unchanged neighbours

Tip

GitHub will not let you zoom an image in a comment. The link under each diagram opens it full size on a page of its own, where you can.

🪧 More tips
  • Run PR Lens on your own machine: npx skills add coldteadotai/pr-lens installs the agent skill. Then tell your coding agent: "Diagram the change you just made with PR Lens and attach it to the pull request."
  • Draw a diff before it is even a pull request: npx @coldtea/pr-lens-cli analyze --base origin/main reads the diff with your own model key, and npx @coldtea/pr-lens-cli render .pr-lens/graph.json draws the same lenses on your machine.
  • The boxes under View are live. Tick Architecture lens or Data flow lens to choose which diagrams appear, or Expand every detail to open every drill-down at once. The comment redraws in place a few seconds later.
  • Show unchanged neighbours lists the components this change did not touch alongside the ones it did, so the drill-down shows what the changed code sits next to.
  • The CLI's render picks up .github/pr-lens.yml automatically and applies your corrections (renames, exclusions, lane pins) at draw time.
  • Would you rather run it from CI on a key of your own? Add .github/workflows/pr-lens.yml with coldteadotai/pr-lens/packages/action@v0 and a model key in your repository secrets, say GEMINI_API_KEY. The Action asks Gemini by default, or OpenAI and any endpoint speaking /chat/completions through its provider input.
  • PR Lens is free for open source. A star on the repository is what keeps it going.
  • Push a new commit and the whole comment re-renders for the new head. An older run never overwrites a newer one, so a slow render cannot put a stale diagram back.
  • The diagrams follow your GitHub theme, so dark mode gets the dark render and light mode the light one, and the moving dots show this pull request's data in motion.

◈ Rendered by PR Lens · crafted with ❤️ by the Coldtea team · Something drawn wrong?

@changeset-bot

changeset-bot Bot commented Sep 2, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 4aeaaac

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@kubb/plugin-react-query Patch
@kubb/plugin-vue-query Patch
@kubb/plugin-swr Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai

coderabbitai Bot commented Sep 2, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: 683c9944-7786-43d0-b679-a0a593e4b0fa

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Folds the package-version lookup and comparison directly into resolveClient.ts
instead of a separate module, and drops the plugin-mcp change beyond the
required root parameter, since it does not call unwrap().

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018r9FQxbCd8tL7Npvu8khvL
@pkg-pr-new

pkg-pr-new Bot commented Sep 2, 2026

Copy link
Copy Markdown
More templates

@kubb/plugin-axios

npm i https://pkg.pr.new/@kubb/plugin-axios@830

@kubb/plugin-cypress

npm i https://pkg.pr.new/@kubb/plugin-cypress@830

@kubb/plugin-faker

npm i https://pkg.pr.new/@kubb/plugin-faker@830

@kubb/plugin-fetch

npm i https://pkg.pr.new/@kubb/plugin-fetch@830

@kubb/plugin-mcp

npm i https://pkg.pr.new/@kubb/plugin-mcp@830

@kubb/plugin-msw

npm i https://pkg.pr.new/@kubb/plugin-msw@830

@kubb/plugin-react-query

npm i https://pkg.pr.new/@kubb/plugin-react-query@830

@kubb/plugin-redoc

npm i https://pkg.pr.new/@kubb/plugin-redoc@830

@kubb/plugin-swr

npm i https://pkg.pr.new/@kubb/plugin-swr@830

@kubb/plugin-ts

npm i https://pkg.pr.new/@kubb/plugin-ts@830

@kubb/plugin-vue-query

npm i https://pkg.pr.new/@kubb/plugin-vue-query@830

@kubb/plugin-zod

npm i https://pkg.pr.new/@kubb/plugin-zod@830

commit: 4aeaaac

@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Size Change: +5.25 kB (+1.68%)

Total Size: 318 kB

📦 View Changed
Filename Size Change
packages/plugin-mcp/dist/index.cjs 10.7 kB +627 B (+6.25%) 🔍
packages/plugin-mcp/dist/index.js 10.2 kB +627 B (+6.57%) 🔍
packages/plugin-mcp/dist/rolldown-runtime-C0LytTxp.js 0 B -168 B (removed) 🏆
packages/plugin-mcp/dist/rolldown-runtime-CRm0XQPb.js 179 B +179 B (new file) 🆕
packages/plugin-react-query/dist/index.cjs 18.4 kB +626 B (+3.52%)
packages/plugin-react-query/dist/index.js 17.8 kB +619 B (+3.59%)
packages/plugin-react-query/dist/rolldown-runtime-C0LytTxp.js 0 B -168 B (removed) 🏆
packages/plugin-react-query/dist/rolldown-runtime-CRm0XQPb.js 179 B +179 B (new file) 🆕
packages/plugin-swr/dist/index.cjs 12.6 kB +633 B (+5.3%) 🔍
packages/plugin-swr/dist/index.js 12.1 kB +643 B (+5.62%) 🔍
packages/plugin-swr/dist/rolldown-runtime-C0LytTxp.js 0 B -168 B (removed) 🏆
packages/plugin-swr/dist/rolldown-runtime-CRm0XQPb.js 179 B +179 B (new file) 🆕
packages/plugin-vue-query/dist/index.cjs 15.5 kB +708 B (+4.77%) 🔍
packages/plugin-vue-query/dist/index.js 15 kB +723 B (+5.06%) 🔍
packages/plugin-vue-query/dist/rolldown-runtime-C0LytTxp.js 0 B -168 B (removed) 🏆
packages/plugin-vue-query/dist/rolldown-runtime-CRm0XQPb.js 179 B +179 B (new file) 🆕
ℹ️ View Unchanged
Filename Size
packages/plugin-axios/dist/index.cjs 15.5 kB
packages/plugin-axios/dist/index.js 15 kB
packages/plugin-axios/dist/rolldown-runtime-C0LytTxp.js 168 B
packages/plugin-cypress/dist/index.cjs 5.71 kB
packages/plugin-cypress/dist/index.js 5.62 kB
packages/plugin-cypress/dist/rolldown-runtime-C0LytTxp.js 168 B
packages/plugin-faker/dist/index.cjs 14.5 kB
packages/plugin-faker/dist/index.js 14.4 kB
packages/plugin-faker/dist/rolldown-runtime-C0LytTxp.js 168 B
packages/plugin-fetch/dist/index.cjs 15.5 kB
packages/plugin-fetch/dist/index.js 15 kB
packages/plugin-fetch/dist/rolldown-runtime-C0LytTxp.js 168 B
packages/plugin-msw/dist/index.cjs 5.81 kB
packages/plugin-msw/dist/index.js 5.72 kB
packages/plugin-msw/dist/rolldown-runtime-C0LytTxp.js 168 B
packages/plugin-redoc/dist/index.cjs 2.21 kB
packages/plugin-redoc/dist/index.js 1.74 kB
packages/plugin-redoc/dist/rolldown-runtime-C0LytTxp.js 168 B
packages/plugin-ts/dist/index.cjs 23.8 kB
packages/plugin-ts/dist/index.js 23.1 kB
packages/plugin-ts/dist/rolldown-runtime-CNktS9qV.js 291 B
packages/plugin-zod/dist/index.cjs 19.7 kB
packages/plugin-zod/dist/index.js 19.6 kB
packages/plugin-zod/dist/rolldown-runtime-C0LytTxp.js 168 B

compressed-size-action

@stijnvanhulle
stijnvanhulle deleted the claude/kubb-plugin-version-error-lafksp branch September 2, 2026 19:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants